<%= render Settings::H1Component.new do %>
  Actions
<% end %>

<p class="text-500 mb-4">Actions can be performed on articles when they are published. Start by writing the keywords to match, just like you would when <a href="/help/search-syntax/">searching</a> for something. Then select the feeds to include. Finally check the actions you would like to perform on the matched incoming articles.</p>

<%= link_to "+ Add Action", new_action_path, class: "button button-huge mb-8" %>

<% if @actions.find { _1.broken? } %>
  <%= render Settings::ControlGroupComponent.new class: "mb-14" do |group| %>
    <% group.header do %>
      Invalid Actions
    <% end %>

    <% @actions.select { _1.broken? }.each do |action| %>
      <% group.item do %>
        <%= render partial: "action", locals: {action: action, summary: true} %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

<% if @actions.find { !_1.broken? } %>
  <%= render Settings::ControlGroupComponent.new class: "mb-14" do |group| %>
    <% group.header do %>
      Saved Actions
    <% end %>

    <% @actions.reject { _1.broken? }.each do |action| %>
      <% group.item do %>
        <%= render partial: "action", locals: {action: action, summary: true} %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

<% if @mutes.present? %>
  <%= render Settings::ControlGroupComponent.new class: "group", data: {capsule: "true"} do |group| %>
    <% group.header do %>
      Mutes
    <% end %>
  <% end %>
  <%= render Actions::MutesComponent.new(mutes: @mutes, user: current_user) %>
<% end %>

